#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/3/11


from gevent import monkey

import gevent
from urllib.request import urlopen

monkey.patch_all()


def f(url):
    print("GET:%s" % url)
    resp = urlopen(url)
    data = resp.read()
    print("%d bytes received from %s." % (len(data), url))


gevent.joinall([
    gevent.spawn(f, "https://www.python.org"),
    gevent.spawn(f, "https://www.yahoo.com"),
    gevent.spawn(f, "https://www.github.com"),
])
